#include <stdio.h>
#include <errno.h>
#include <string.h>


int main(int argc, char const *argv[])
{
    // 打开文件
    FILE *fp = fopen("3_统计字符单词.txt", "w");
    // 文件写入

    char buf[128] ="女人要iphone手机\n你是word我是need谁\n农场主niger大王\n";

    fseek(fp, 0, SEEK_SET);
    fwrite(buf, 1, strlen(buf), fp);
    // 文件读取
    //char buf[128];
    fseek(fp, 0, SEEK_SET);
    size_t i = fread(buf, 1, sizeof(buf)-1, fp);
    fread(buf, 1, sizeof(buf)-1, fp);
    printf("%ld\n%s\n",i,buf);
    // 文件关闭
    fclose(fp);
    return 0;
}
